<?php
header('Content-type:text/html;charset=utf-8');
?>
<html>
<head>
    <style>
        p{ width:100%;height:30px;font-size: 30px;margin-left: 100px;}
    </style>
</head>
<body>
<div>
    <h1 align="center">获取文件后缀</h1>
    <?php
    function getFileExt($path){$ext=substr($path,strrpos($path,'.')+1);
        return $ext;}
    $path='C:\images\yingbao.jpg';
    $ext=getFileExt($path);
    echo "<p>文件路径:$path</p>";
    echo"<p>文件后缀:$ext</p>";
    ?>
</div>
</body>
</html>
